package com.zmn.brs.common.enums;

import java.util.Optional;
import java.util.stream.Stream;

/**
 * 类描述：事件类型枚举
 *
 * @author xujie
 * @since 2021/03/19 10:47
 */
public enum EventTypeEnum {

    /**
     *
     */
    LOGIN(1, "登录" , ""),
    EXPORT(2, "导出" , ""),
    QUERY(3, "查询" , ""),
    FRONT_DESK_ORDER(4, "前台下单" , ""),
    WORK_ORDER_MANAGE(5, "工单管理" , ""),
    VALUE_ADDED_WORK_ORDER_MANAGE(6, "增值工单管理" , ""),
    OBJECTIVE(7, "目标管理" , "/brs/objective/rule/list.action"),
    COMPARISON(8, "人单比" , "/brs/order/rule/comparison/list.action"),
    QUANTITY(9, "城市单量" , "/brs/order/rule/quantity/list.action"),
    CALLS(10, "呼叫进线量" , "/brs/order/rule/calls/list.action"),
    ENGINEER_UNPAID(11, "收款未支付金额" , "/brs/engineer/rule/unpaid/list.action"),
    ENGINEER_SALES(12, "派单客单价" , "/brs/engineer/rule/sales/list.action"),
    ;

    /**
     * 类型
     */
    private final Integer typeId;

    /**
     * 类型名
     */
    private final String typeName;

    /**
     * 规则列表地址
     */
    private final String ruleUrl;

    EventTypeEnum(Integer typeId, String typeName, String ruleUrl) {

        this.typeId = typeId;
        this.typeName = typeName;
        this.ruleUrl = ruleUrl;
    }

    public Integer getTypeId() {

        return typeId;
    }

    public String getTypeName() {

        return typeName;
    }

    public String getRuleUrl() {

        return ruleUrl;
    }

    public static EventTypeEnum getEventTypeEnum(Integer typeId) {

        Optional<EventTypeEnum> optional = Stream.of(EventTypeEnum.values()).filter(e -> e.getTypeId().equals(typeId)).findFirst();
        return optional.orElse(null);
    }
}
